package server.controller.userController;

import server.model.factory.ModelFactory;
import server.util.InfoUtils.Info;
import server.util.InfoUtils.InfoEnum;
import server.util.InfoUtils.InfoUtil;
import server.util.MyUtils;
import server.util.ResponseUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/getOtherUserInfo")
public class GetOtherUserInfo extends HttpServlet {
    private static final long serialVersionUID = 8723784253456430316L;

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String str_userId = req.getParameter("userId");
        if (!MyUtils.NOTNULL(str_userId)) {
            ResponseUtil.responseMessage(resp, InfoUtil.getInfo(InfoEnum.PARAMS_NULL));
        }
        Integer userId=Integer.parseInt(str_userId);
        Info info = ModelFactory.getUserInfoModel().getOtherUserInfo(userId);
        ResponseUtil.responseMessage(resp, info);
    }
}